﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Pawn.cs" company="">
//   
// </copyright>
//  <summary>
//   The pawn.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Shatranj
{
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// The pawn.
    /// </summary>
    public class Pawn : ChessPiece
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Pawn"/> class.
        /// </summary>
        /// <param name="currentSquare">
        /// The current square.
        /// </param>
        /// <param name="force">
        /// The force.
        /// </param>
        public Pawn(BoardSquare currentSquare, Army force)
            : base(currentSquare, force, true)
        {
            this.Identity = Piece.Pawn;
            this.CanJumpOver = false;
            this.IsPromotable = true;
            this.Enpassant = true;
            this.CanCaptureAcross = true;
            this.InitialMaxStepAllowed = true;
            this.InitialMaxStep = 2;
            this.AltChar = (this.Force == Army.White) ? 'p' : 'o';
            this.CharNotationAsNumber = (this.Force == Army.White) ? 112 : 111;

            if (this.MovePaths != null)
            {
                return;
            }

            this.SetMovePaths(
                this.Identity, 
                new Dictionary<string, ICollection<MovePath>>
                    {
                        {
                            "1", 
                            new List<MovePath>
                                {
                                    new MovePath
                                        {
                                            Direction =
                                                (force
                                                 == Army
                                                        .White)
                                                    ? MoveDirection
                                                          .North
                                                    : MoveDirection
                                                          .South, 
                                            Ordinal = 1, 
                                            MinStep = 1, 
                                            MaxStep = 2
                                        }
                                }
                        }
                    });
        }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// The move.
        /// </summary>
        /// <param name="newLocation">
        /// The new location.
        /// </param>
        /// <param name="options">
        /// The options.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public override bool Move(BoardSquare newLocation, MoveOptions options)
        {
            if (this.IsLegal(newLocation))
            {
                this.CurrentLocation = newLocation;
            }

            return false;
        }

        /// <summary>
        /// The move.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public override bool Move()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}